//
// Created by 周杰 on 2020/1/13.
//

#include "FilterTest.h"

const string image_path = "/Volumes/D/study/machinelearning/opencv/testpic/lenacolor.bmp";

/**
 * 都变得模糊了，lenacolor图片上看均值滤波效果没有高斯滤波和中值滤波效果好
 */
void FilterTest::filterTest() {
    Mat source_image = imread(image_path);
    imshow("source image.", source_image);

    //均值滤波
    Mat blur_image;
    blur(source_image, blur_image, Size(3, 3));
    imshow("avg image.", blur_image);

    //高斯滤波
    Mat gaussian_image;
    GaussianBlur(source_image, gaussian_image, Size(3, 3), 0);
    imshow("gaussian image.", gaussian_image);

    //中值滤波
    Mat median_image;
    medianBlur(source_image, median_image, 3);
    imshow("median image.", median_image);

    waitKey();
    destroyAllWindows();
}

